package cc.realxyq.demo.config;

import cc.realxyq.demo.bean.Person;
import cc.realxyq.demo.bean.Teacher;
import cc.realxyq.demo.component.MyBeanNameGenerator;
import cc.realxyq.demo.condition.MyImportBeanDefinitionRegistrar;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 *
 * @author kwhan
 * @date 2022年01月09日 13:22
 */
@ComponentScan(value = "cc.realxyq.demo.dao", nameGenerator = MyBeanNameGenerator.class)
@Configuration
@Import({Person.class, MyImportBeanDefinitionRegistrar.class})
public class BeanNameGeneratorConfig {
    @Bean
    public Teacher teacher() {
        return new Teacher("default", 22);
    }

    @Bean(value = "myTeacher")
    public Teacher teacher2() {
        return new Teacher("Han", 18);
    }
}
